package com.pengpeng.dynamic.controller;

import com.pengpeng.dynamic.config.DataSource;
import com.pengpeng.dynamic.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 彭鹏
 * @date 2021/11/4.
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;


    @DataSource(value="master")
    @PostMapping(value="/findAll1")
    public Object findAll1() {
        return userService.findAll();
    }

    @DataSource(value="slave")
    @PostMapping(value="/findAll2")
    public Object findAll2() {
        return userService.findAll();
    }

}
